<?php
header('Content-Type:text/html;charset=utf-8');
require('../../public/zscg.php');
require('../../public/local.php');
$res=select2($con,'user','where `id` = 1')[0];
// $bijiao=strcasecmp($_COOKIE['yzm'],$_POST['yzm']);
// if($bijiao!= 0){
//     echo "<script>alert('验证码输入错误');window.location.href='log.html'</script>";
// }
if($_POST['username'] == $res['nicheng'] && md5($_POST['pwd']) == $res['password']){
    setcookie("username",$res['nicheng'],0,'/');
    setcookie("password",$res['password'],0,'/');
    echo "<script>window.location.href='/admin/guanli.php'</script>"; 
}else{
    echo "<script>alert('登录失败');window.location.href='/admin/index.php'</script>";
    setcookie("username",'',0,'/');
    setcookie("password",'',0,'/');
}
